import axios from 'axios';

// 新增评论
export const addComment = (commentData) => {
    return axios.post('/api/comments', commentData);
};

// 删除评论
export const deleteComment = (commentId) => {
    return axios.delete(`/api/comments/${commentId}`);
};

// 根据文章ID获取评论列表
export const getCommentsByPostId = (postId) => {
    return axios.get(`/api/comments/post/${postId}`);
};

// 根据评论ID获取单个评论
export const getCommentById = (commentId) => {
    return axios.get(`/api/comments/${commentId}`);
};

// 更新评论内容
export const updateComment = (commentId, content) => {
    return axios.put(`/api/comments/${commentId}`, { content });
};
